package com.sjhang.controller;


import com.sjhang.entity.TbCollect;
import com.sjhang.service.TbCollectService;
import com.sjhang.utils.ListParamVo;
import com.sjhang.utils.ResultResponse;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 用户收藏文章表
 */
@Api(tags = {"用户收藏接口"})
@RestController
@RequestMapping("/tbCollect")
public class TbCollectController {
    
    @Resource
    private TbCollectService tbCollectService;

    /***
     * @description 查询某个用户的收藏，根据个人id
     */
    @PostMapping("/selectCollect")
    public ResultResponse selectCollect(@RequestBody ListParamVo listParamVo){
        return tbCollectService.selectCollect(listParamVo);
    }

    /**
     * @description 添加文章到我的收藏
     * @params [listParamVo]
     */
    @PostMapping("/insertCollect")
    public ResultResponse insertCollect(TbCollect tbCollect){
        return tbCollectService.insertCollect(tbCollect);
    }

    /***
     * @description 从我的收藏里删除某一个
     * @params [listParamVo]
     */
    @PostMapping("/deleteCollect")
    public ResultResponse deleteCollect(Long collectID){
        return tbCollectService.deleteCollect(collectID);
    }

    /***
     * @description 修改我的收藏
     * @params [listParamVo]
     */
    @PostMapping("/updateCollect")
    public ResultResponse updateCollect(TbCollect tbCollect){
        return tbCollectService.updateCollect(tbCollect);
    }


}

